package com.qf.fronted.controller;

import com.qf.fronted.domain.Goods;
import com.qf.fronted.service.impl.GoodServiceImpl;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户首页中展示所有商品信息
 */
@RestController
@CrossOrigin("*")
@RequestMapping(value = "/good", name = "FrontedGoodServlet")
public class GoodController {
    private GoodServiceImpl goodServiceImpl;
    public GoodController(GoodServiceImpl goodServiceImpl) {
        this.goodServiceImpl = goodServiceImpl;
    }

    @GetMapping
   public List<Goods> getAll(){
        List<Goods> goodsList = goodServiceImpl.getAll();
      return goodsList;
    }
}
